const userService = require('../services/userService')

class userController {
    async register(ctx) {
        const body = await userService.register(ctx)
        ctx.body = body
    }

    async login(ctx) {
        const body = await userService.login(ctx)
        ctx.body = body
    }

    async editor(ctx) {
        const body = await userService.editor(ctx)
        ctx.body = body
    }
    async fileImg(ctx) {
        const data = await userService.fileImg(ctx)
        console.log(data, '---data---');
        ctx.body = await {
            url: data.data.url,
            msg: '上传成功',
            status: 200
        }
    }
    async publicImg(ctx){
        const body = await userService.publicImg(ctx)
        ctx.body = body
    }

    async getmessages(ctx){
        const body = await userService.getmessages(ctx)
        ctx.body = body
    }
    async ownerMessages(ctx){
        const body = await userService.ownerMessages(ctx)
        ctx.body = body
    }
    async allUsers(ctx){
        const data = await userService.allUsers(ctx)
        ctx.body = data
    }
    async test(ctx){
        console.log('到了controller层');
        const data = await userService.test(ctx)
        ctx.body = data
    }

    async getOnlyMessage(ctx){
        const body = await userService.getOnlyMessage(ctx)
        ctx.body = body
    }

    async savaRegister(ctx){
        const body = await userService.savaRegister(ctx)
        ctx.body = body
    }

    async addGood(ctx){
        const body = await userService.addGood(ctx)
        ctx.body = body
    }

    async removeGood(ctx){
        const body = await userService.removeGood(ctx)
        ctx.body = body
    }
    async deletePublicImg(ctx){
        const body = await userService.deletePublicImg(ctx)
        ctx.body = body
    }

    async addAttention(ctx){
        const body = await userService.addAttention(ctx)
        ctx.body = body
    }

    async addComment(ctx){
        const body = await userService.addComment(ctx)
        ctx.body = body
    }

    async searchComment(ctx){
        const body = await userService.searchComment(ctx)
        ctx.body = body
    }

    async searchAttention(ctx){
        const body = await userService.searchAttention(ctx)
        ctx.body = body
    }
}

module.exports = new userController();